<template>
  <div>
      <h1>删除页面</h1>
    <el-form
      :model="ruleForm"
      status-icon
    
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-form-item label="帐号" prop="username">
        <el-input
          type="password"
          v-model="ruleForm.username"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input
          type="password"
          v-model="ruleForm.password"
          autocomplete="off"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')"
          >提交</el-button
        >
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
 

    return {
      ruleForm: {
        username: "",
        password: "",
      },
     
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
        //   alert("submit!");
        console.log(this.ruleForm.username)
        this.$http.post('http://localhost:8088/delete',this.ruleForm).then(res=>{
            if(res.data.status){
                console.log("删除成功！")
            }else{
                console.log("删除失败！")
            }
        })
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>